package com.github.jspxnet.worktask.model.dto;

import com.github.jspxnet.json.JsonField;
import com.github.jspxnet.sober.annotation.Column;
import com.github.jspxnet.utils.StringUtil;
import com.github.jspxnet.worktask.model.enums.JobEnumType;
import lombok.Data;
import java.io.Serializable;

//@Table(name = "jwf_flow_job", caption = "流程动作任务")
@Data
public class ConfFlowJobDto implements Serializable {

    @Column(caption = "ID")
    private long id = 0;

    @Column(caption = "命名空间", length = 50, dataType = "isLengthBetween(1,50)")
    private String namespace = StringUtil.empty;

    @Column(caption = "流程编号", length = 32)
    private String flowNo = StringUtil.empty;

    //不能等于本节点
    @Column(caption = "所属节点ID", length = 32)
    private String nodeId = StringUtil.empty;

    @Column(caption = "条件类型", length = 2,enumType = JobEnumType.class )
    private int jobType = JobEnumType.NONE.getValue();

    //如果是抄送,签收这里是 用户对象
    @Column(caption = "用户对象", length = 1000)
    private String users = StringUtil.empty;

    //人数条件
    @Column(caption = "或签人数")
    private int memberCount = 1;

    //有可能是执行一个类的方法,或者是调用一个http 接口

    @Column(caption = "脚本类型", length = 20)
    private String scriptType = StringUtil.empty;

    //有条件的流程,这里是流程判断脚本
    @Column(caption = "脚本", length = 10000)
    private String script = StringUtil.empty;

    //要执行的动作类
    @Column(caption = "调用代码类", length = 100)
    private String className = StringUtil.empty;

    @Column(caption = "调用的方法名", length = 100)
    private String callMethod = StringUtil.empty;


    @JsonField(name = "title",caption = "描述")
    public String getTile() {
        return JobEnumType.find(jobType).getName();
    }
}
